Required Knowledge
Jump to navigation
Jump to search
This page or section refers to its readers or editors using I, my, we or us. It should be edited to be in an encyclopedic tone. |
Beginners in OSDev are strongly recommended not to skip this.
Writing an OS is not a beginner's task. In fact, writing an OS is usually considered the most difficult programming task. Above-average programming skills are needed before even considering a project like this. Failure to comply will make you look silly.
Developing an OS requires these knowledge:
- Basic Computer Science: intimate familiarity with hexadecimal and binary notation as well as boolean logic and similar fundamental knowledge, like data structures, their construction and manipulation, searching and sorting algorithms, abstract programming concepts, etc. etc...
- Language and Vocabulary: ability to read and write (technical) English at a competent level. Virtually all technical documentation is in English, and most of the resources you could find on the web (like this Wiki and the forum) are, also. Using incorrect terminology will make you look foolish and confuse the people willing to help you.
- Language and Vocabulary, pt. 2: Most operating systems featured on this site, as well as most of the code snippets and examples, are written in C (or C++). Individuals should be competent in making heads and tails of it even if they choose to use another language (like FreeBASIC or Pascal), since C is the lingua franca of programming.
- Assembly: knowledge about the low-level language Assembly. Read a book. Take a course at school. Write some user-space code to familiarize yourself with it. You will need it, even if you plan to write most of your operating system in a higher-level language.
- Programming experience: Learning about programming with an OS project is considered a bad idea. Not only should you know the language in which you will be developing inside out, you should also be familiar with version control, debugging, etc. In short, you should have written quite a few user-space programs in that language successfully before trying OS development.
- Programming Practices: You should know how to write both code and user documentation, and be prepared to carefully document all aspects of your code and design, even if the project is purely for your personal use. Also, you should learn and use suitable Code Management practices, including setting up and using an off-site repository (e.g. Savannah, GitHub, GitLab, Heroku). These two practices alone will--not may, but will--save you a great deal of trouble in the future, if you follow them.
- UNIX experience: You will soon notice that many of the tools used in OS development are developed for Unix and later ported over to Windows. The Linux kernel is often used as a reference or example for how things can be done, and many of the hobby operating systems have some resemblance to Unix. Having experience with the Unix command line (preferably Bash or ksh) is a very important requirement. (Cygwin provides an easy-to-install Unix command line for Windows.) If you haven't, go ahead and use Linux or a BSD for a while. For Windows users, this can be accomplished quite easily by using a virtualizer (see below) to host a virtual system, without the need to re-partition your home system. You could also install Windows Subsystem for Linux (WSL) within Windows itself to get access to the Unix command line. For macOS users, you can simply use the Terminal--macOS is built on a Unix variant kernel (a combination of the Mach and BSD kernels), so as long as you have Xcode and an emulator or virtualizer installed, no further tools are necessary (though you will need to set up a cross-compiler); the default Terminal shell is the Z Shell, but C shell and KornShell are available as well.
- Toolchain: You must know the behavioral details of your compiler, assembler, linker, and make utility. You should know what the emitted warnings and errors mean. You should have the documentation of the tools you use at hand, and refer to them before asking the community. Rest assured that any possible beginner's question about GCC, GNU as, NASM, GNU ld, Visual Studio, and GRUB have been answered twice over. Search before you ask.
- Emulators and Virtualizers: Familiarity with tools such as Bochs, VirtualBox, QEMU, or Virtual PC is key to having a reasonable turn-around in development. These tools provide a buffer between your real hardware and your test system. While these can be learned for the specific purpose of OS dev, you will certainly want to be aware of what they are and where to get them before beginning an OS project.
- Executable Formats: Kernel space programming has many additional requirements unknown to application development. Being able to parse executable binaries is one of them (you do want your OS to load and execute applications, don't you?) Make yourself familiar with Executable File Types, their internal structure, and how a linker generates them.
- The Platform: You should have studied the manuals for the processor you will be programming for. They contain the information you need to design your kernel in the first place. Asking for information that can easily be obtained from these documents will only give cause to "Read The (...) Manual" responses, or simply RTFM.
- The Concept: You should have an understanding of how existent operating systems function at the technical level (e.g. by having read some Books), what is good or bad about them, and how you want to go about your own OS. Having finished some tutorial and then asking "what now?" in one of the forums will just make you look silly.
See Also
- A particularly good and excellent (but unfortunately unfinished as of yet) book on the topic: Operating Systems From 0 to 1. This focuses on everything you need to know, from the transistor to logic circuits, Assembly and C language, ELF format and debugging etc. Read (and understand!) this book to get a quick-start on required knowledge.